/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package Tableau;

import Personne.Personne;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Morgan
 */
@Entity
public class Tableau implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String description;
    private int prixDepart, prixDeVente;
    private Boolean isVendu;
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateDeb, dateFin;
    @ManyToOne
    private Personne acheteur;

    public Tableau(){
        dateDeb = new Date();
    }
    
    public Tableau(String p_description, int p_prixDeb, Date p_dateFin){
        dateDeb = new Date();
        dateFin = p_dateFin;
        description = p_description;
        prixDepart = p_prixDeb;
        isVendu = false;
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tableau)) {
            return false;
        }
        Tableau other = (Tableau) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Tableau.Tableau[ id=" + id + " ]";
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the prixDepart
     */
    public int getPrixDepart() {
        return prixDepart;
    }

    /**
     * @param prixDepart the prixDepart to set
     */
    public void setPrixDepart(int prixDepart) {
        this.prixDepart = prixDepart;
    }

    /**
     * @return the prixDeVente
     */
    public int getPrixDeVente() {
        return prixDeVente;
    }

    /**
     * @param prixDeVente the prixDeVente to set
     */
    public void setPrixDeVente(int prixDeVente) {
        this.prixDeVente = prixDeVente;
    }

    /**
     * @return the isVendu
     */
    public Boolean getIsVendu() {
        return isVendu;
    }

    /**
     * @param isVendu the isVendu to set
     */
    public void setIsVendu(Boolean isVendu) {
        this.isVendu = isVendu;
    }

    /**
     * @return the dateDeb
     */
    public Date getDateDeb() {
        return dateDeb;
    }

    /**
     * @param dateDeb the dateDeb to set
     */
    public void setDateDeb(Date dateDeb) {
        this.dateDeb = dateDeb;
    }

    /**
     * @return the dateFin
     */
    public Date getDateFin() {
        return dateFin;
    }

    /**
     * @param dateFin the dateFin to set
     */
    public void setDateFin(Date dateFin) {
        this.dateFin = dateFin;
    }

    /**
     * @return the acheteur
     */
    public Personne getAcheteur() {
        return acheteur;
    }

    /**
     * @param acheteur the acheteur to set
     */
    public void setAcheteur(Personne acheteur) {
        this.acheteur = acheteur;
    }
    
}
